(global.webpackJsonp = global.webpackJsonp || []).push([["plugins/mch/mch/add-goods/add-goods"], {
  "4b13": function(e, t, i) {
      i.r(t);
      var o = i("6d2c"),
      n = i.n(o);
      for (var a in o)"default" !== a &&
      function(e) {
          i.d(t, e,
          function() {
              return o[e]
          })
      } (a);
      t.
  default = n.a
  },
  "6d2c": function(e, t, i) { (function(e) {
          function o(e, t) {
              var i = Object.keys(e);
              if (Object.getOwnPropertySymbols) {
                  var o = Object.getOwnPropertySymbols(e);
                  t && (o = o.filter(function(t) {
                      return Object.getOwnPropertyDescriptor(e, t).enumerable
                  })),
                  i.push.apply(i, o)
              }
              return i
          }
          function n(e, t, i) {
              return t in e ? Object.defineProperty(e, t, {
                  value: i,
                  enumerable: !0,
                  configurable: !0,
                  writable: !0
              }) : e[t] = i,
              e
          }
          Object.defineProperty(t, "__esModule", {
              value: !0
          }),
          t.
      default = void 0;
          var a = {
              data: function() {
                  return {
                      postageIndex: -1,
                      height: 0,
                      beSubmit: !1,
                      form: {},
                      forehead: -1,
                      unit: "件",
                      iphone_x: !1,
                      modal: !1,
                      error: !1,
                      set_cat: !1,
                      set_mch_cat: !1,
                      set_postage: !1,
                      set_service: !1,
                      confine: !1,
                      is_service: !1,
                      img: [],
                      cat: [],
                      mch: 0,
                      mch_cat: [],
                      goods_detail: [],
                      beMove: !1,
                      service: [],
                      postage: [],
                      beCat: [{
                          label: "未选择"
                      }],
                      beMchCat: [{
                          label: "未选择"
                      }],
                      isChooseCat: ["未选择"],
                      bePostage: "",
                      beService: [],
                      in_cat: "",
                      in_mch_cat: "",
                      newIndex: "0",
                      index: "0",
                      attr: [],
                      have_children: !1,
                      disabled: !0,
                      imgHidden: !0,
                      flag: !1,
                      x: 0,
                      y: 0,
                      first_service: !0,
                      choose_list: [],
                      elements: [],
                      img_src: "",
                      dialog: !1,
                      loading: !1
                  }
              },
              computed: function(e) {
                  for (var t = 1; t < arguments.length; t++) {
                      var i = null != arguments[t] ? arguments[t] : {};
                      t % 2 ? o(i, !0).forEach(function(t) {
                          n(e, t, i[t])
                      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(i)) : o(i).forEach(function(t) {
                          Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t))
                      })
                  }
                  return e
              } ({},
              (0, i("2f62").mapState)({
                  theme: function(e) {
                      return e.mallConfig.theme
                  },
                  userInfo: function(e) {
                      return e.user.info
		      }
              })),
              methods: {
                  toSubmit: function() {
                      var t = this;
                      if (t.loading) return ! 1;
                      e.showLoading({
                          title: "提交中..."
                      }),                      
		      t.beSubmit = !1,
		      t.loading = !0,
		       t.$request({
                          url: t.$api.mch.edit,
                          data: {
                              form: JSON.stringify(t.form),
                              mch_id: t.mch_id
                          },
                          method: "post"
                      }).then(function(i) {
                          
			  
			  t.loading = !1,
                          t.$hideLoading(),
                          0 == i.code ? (t.$hideLoading(), e.hideLoading(), 0 == i.code ? (e.showToast({
                              title: i.msg,
                              duration: 1e3
                          }), e.setStorage({
                              key: "goods_status",
                              data: "保存成功"
                          }), setTimeout(function() {
                              e.navigateBack()
                          },
                          500)) : e.showToast({
                              title: i.msg,
                              icon: "none",
                              duration: 1e3
                          })) : e.showToast({
                              title: i.msg,
                              icon: "none",
                              duration: 1e3
                          })
                      }).
                      catch(function() {
                          t.loading = !1,
                          t.$hideLoading(),
                          e.hideLoading()
                      })
                  },
                  submit: function() {
                      var e = !1,
                      t = this,
                      i = t.form;
                      if (! (t.img.length > 0)) return t.error = "请上传商品图片",
                      !1;
                      if (i.pic_url = t.img, !i.name) return t.error = "请设置商品名称",
                      !1;
                      if (i.cats = [], "未选择" == t.beCat[0].label) return t.error = "请设置商品分类",
                      !1;
                      if (t.beCat.forEach(function(e) {
                          i.cats.push(e.value)
                      }), "未选择" == t.beMchCat[0].label) return t.error = "请设置多商户分类",
                      !1;
                      if (t.beMchCat.forEach(function(e) {
                          i.cats.push(e.value)
                      }), !t.unit) return t.error = "请设置商品单位",
                      !1;
                      if (i.unit || (i.unit = t.unit), !i.cost_price) return t.error = "请设置商品成本价",
                      !1;
                      if (i.cost_price < 0) return t.error = "成本价不得小于零",
                      !1;
                      if (!i.original_price) return t.error = "请设置商品原价",
                      !1;
                      if (i.original_price < 0) return t.error = "商品原价不得小于零",
                      !1;
                      if (t.attr.length > 0) i.use_attr = 1,
                      i.goods_num = 0,
                      t.attr.forEach(function(i, o) {
                          return t.attr[o].attr_list[0].attr_name ? t.attr[o].price ? t.attr[o].stock ? void(o == t.attr.length - 1 && (e = !0)) : (t.error = "请输入规格库存", !1) : (t.error = "请输入规格售价", !1) : (t.error = "请输入规格名", !1)
                      }),
                      i.attr = t.attr;
                      else {
                          if (i.use_attr = 0, i.attr = [], !i.price) return t.error = "请设置商品售价",
                          !1;
                          if (!i.goods_num) return t.error = "商品库存不得为空",
                          !1;
                          if (i.goods_num < 0) return t.error = "商品库存不得小于零",
                          !1;
                          if (i.price < .01) return t.error = "商品售价不得小于零",
                          !1;
                          e = !0
                      }
                      if (i.services = [], t.beService.length > 0 && (i.services = t.beService), i.status = 0, i.virtual_sales = 0, i.cover_pic = "", i.sort = 100, i.accumulative = 1, i.member_price = {},
                      i.mchCats = [], !(t.goods_detail.length > 0)) return t.error = "请设置图文描述",
                      !1;
                      i.detail = "",
                      t.goods_detail.forEach(function(e) {
                          i.detail += "<p><img src=" + e.pic_url + "></p>"
                      }),
                      i.forehead_integral && (i.forehead_integral > 0 ? i.forehead_integral_type: (i.forehead_integral_type, i.forehead_integral = i.forehead_integral.replace("%", ""))),
                      i.give_integral && (i.give_integral > 0 ? i.give_integral_type: (i.give_integral_type, i.give_integral = i.give_integral.replace("%", ""))),
                      i.freight_id = t.bePostage.id,
                      i.freight = t.bePostage,
                      i.individual_share = 0,
                      i.is_level = 0,
                      i.individual_share = 0,
                      i.mch_id = t.mch_id,
                      i.sign = "mch",
                      i.video_url = "",
                      e && (t.form = i, t.beSubmit = !0)
                  },
                  close: function() {
                      this.error = null,
                      this.set_cat = !1,
                      this.set_mch_cat = !1,
                      this.set_postage = !1,
                      this.set_service = !1,
                      this.modal = !1
                  },
                  inputAttr: function(e) {
                      this.attr[e].attr_list[0].attr_id = ( + e + 2).toString()
                  },
                  _longtap: function(t, i, o) {
                      var n = this;
                      e.createSelectorQuery().selectAll(".move-img").fields({
                          dataset: !0,
                          rect: !0
                      },
                      function(e) {
                          n.elements = e
                      }).exec(),
                      n.img[i].pic_url = "",
                      n.x = o.currentTarget.offsetLeft,
                      n.y = o.currentTarget.offsetTop,
                      n.imgHidden = !1,
                      n.flag = !0,
                      n.beMove = !0,
                      n.img_src = t,
                      n.beginIndex = i
                  },
                  touchend: function(e) {
                      var t = this;
                      if (t.flag) {
                          for (var i = e.changedTouches[0].pageX, o = e.changedTouches[0].pageY, n = t.elements, a = t.img, r = t.beginIndex, c = 0; c < n.length; c++) {
                              var s = n[c];
                              if (i > s.left && i < s.right && o > s.top && o < s.bottom) {
                                  var h = s.dataset.index;
                                  if (r < h) {
                                      for (var d = a[r], l = r; l < h; l++) a[l] = a[l + 1];
                                      a[h] = d
                                  }
                                  if (r > h) {
                                      for (var u = a[r], f = r; f > h; f--) a[f] = a[f - 1];
                                      a[h] = u
                                  }
                                  a[h].pic_url = t.img_src,
                                  t.img = a
                              }
                          }
                          t.img[r].pic_url || (t.img[r].pic_url = t.img_src),
                          t.imgHidden = !0,
                          t.flag = !1,
                          t.beMove = !1,
                          t.beginIndex = null
                      }
                  },
                  touchm: function(e) {
                      if (this.flag) {
                          var t = e.touches[0].pageX,
                          i = e.touches[0].pageY;
                          this.x = t - 60,
                          this.y = i - 129
                      }
                  },
                  cancelService: function() {
                      var e = this.beService,
                      t = this.service;
                      e.length > 0 ? t.forEach(function(t) {
                          t.isChoose = !1,
                          e.forEach(function(e) {
                              e.id == t.id && (t.isChoose = !0)
                          })
                      }) : t.forEach(function(e) {
                          e.isChoose = !1
                      }),
                      this.beService = e,
                      this.service = t,
                      this.set_service = !1,
                      this.is_service = !1
                  },
                  submitService: function() {
                      var e = [];
                      this.service.forEach(function(t) {
                          t.isChoose && e.push(t)
                      }),
                      this.beService = e,
                      this.set_service = !1,
                      this.is_service = !1
                  },
                  choose: function(e) {
                      var t = this;
                      t.service.forEach(function(i) {
                          i.id == e.id && (i.isChoose = !i.isChoose, t.$forceUpdate())
                      })
                  },
                  toGoodsDetail: function() {
                      e.navigateTo({
                          url: "/plugins/mch/mch/goods-detail/goods-detail"
                      })
                  },
                  add_img: function() {
                      var t = this,
                      i = 9 - t.img.length;
                      e.chooseImage({
                          count: i,
                          sizeType: ["original", "compressed"],
                          sourceType: ["album", "camera"],
                          success: function(i) {
                              var o = i.tempFilePaths,
                              n = t.img;
                              o.forEach(function(i, a) {
                                  e.showLoading({
                                      title: "上传中..."
                                  });
                                  e.uploadFile({
                                      url: t.$api.upload.file,
                                      filePath: i,
                                      name: "file",
                                      fileType: "image",
                                      formData: {
                                          file: i,
                                          file_name: ""
                                      },
                                      success: function(i) {
                                          var r = JSON.parse(i.data),
                                          c = {
                                              pic_url: r.data.url,
                                              id: r.data.id
                                          };
                                          0 == r.code && n.push(c),
                                          t.img = n,
                                          a == o.length - 1 && e.hideLoading()
                                      },
                                      fail: function(t) {
                                          e.showToast({
                                              title: t.msg,
                                              icon: "none",
                                              duration: 1e3
                                          })
                                      }
                                  })
                              })
                          }
                      })
                  },
                  del_img: function(e) {
                      this.img.splice(e, 1)
                  },
                  chooseCat: function() {
                      this.set_cat = !0,
                      0 == this.cat.length ? this.modal = !0 : (this.dialog = !0, this.in_cat = null, this.index = 0, this.have_children = !1, this.beCat = [{
                          label: "未选择"
                      }], this.isChooseCat = ["未选择"], this.choose_list = this.cat, this.$forceUpdate())
                  },
                  chooseMchCat: function() {
                      this.set_mch_cat = !0,
                      0 == this.mch_cat.length ? this.modal = !0 : (this.dialog = !0, this.in_mch_cat = null, this.index = 0, this.have_children = !1, this.beMchCat = [{
                          label: "未选择"
                      }], this.isChooseCat = ["未选择"], this.choose_list = this.mch_cat, this.$forceUpdate())
                  },
                  bindChange: function(e) {
                      this.newIndex = e.detail.value[0]
                  },
                  choose_cat: function() {
                      var e = this,
                      t = e.beCat,
                      i = !1,
                      o = e.cat[e.newIndex],
                      n = e.index;
                      if (e.have_children && (o = t[n - 1].children[e.newIndex - 1]), t[n] = o, n++, o) {
                          var a, r = [];
                          t.forEach(function(e) {
                              r.push(e.label)
                          }),
                          r.push("未选择"),
                          e.isChooseCat = r,
                          o.children ? (e.choose_list = [{
                              label: "不选择"
                          }], setTimeout(function() {
                              o.children.forEach(function(t) {
                                  e.choose_list.push(t)
                              })
                          },
                          0), i = !0) : (t.forEach(function(e, t) {
                              e.label.length > 5 && (e.label = e.label.slice(0, 4) + "..."),
                              0 == t ? a = e.label: a += "/" + e.label
                          }), e.in_cat = a, e.dialog = !1, e.set_cat = !1)
                      } else {
                          var c;
                          t.pop(),
                          t.forEach(function(e, t) {
                              0 == t ? c = e.label: c += "/" + e.label
                          }),
                          e.in_cat = c,
                          e.dialog = !1,
                          e.set_cat = !1
                      }
                      e.newIndex = "0",
                      e.beCat = t,
                      e.index = n,
                      e.have_children = i
                  },
                  choose_mch_cat: function() {
                      var e = this,
                      t = e.beMchCat,
                      i = !1,
                      o = e.mch_cat[e.newIndex],
                      n = e.index;
                      if (e.have_children && (o = t[n - 1].children[e.newIndex - 1]), t[n] = o, n++, o) {
                          var a, r = [];
                          t.forEach(function(e) {
                              r.push(e.label)
                          }),
                          r.push("未选择"),
                          e.isChooseCat = r,
                          o.children ? (e.choose_list = [{
                              label: "不选择"
                          }], setTimeout(function() {
                              o.children.forEach(function(t) {
                                  e.choose_list.push(t)
                              })
                          },
                          0), i = !0) : (t.forEach(function(e, t) {
                              e.label.length > 5 && (e.label = e.label.slice(0, 4) + "..."),
                              0 == t ? a = e.label: a += "/" + e.label
                          }), e.in_mch_cat = a, e.dialog = !1, e.set_mch_cat = !1)
                      } else {
                          var c;
                          t.pop(),
                          t.forEach(function(e, t) {
                              0 == t ? c = e.label: c += "/" + e.label
                          }),
                          e.in_mch_cat = c,
                          e.dialog = !1,
                          e.set_cat = !1
                      }
                      e.newIndex = "0",
                      e.beMchCat = t,
                      e.index = n,
                      e.have_children = i
                  },
                  toggle: function(e) {
                      this.choose_list = [],
                      this.dialog = !1,
                      this.set_cat = !1,
                      this.set_mch_cat = !1,
                      1 == e ? this.set_postage && (this.bePostage = this.postage[this.newIndex]) : this.set_postage = !1
                  },
                  add_attr: function() {
                      var e = {
                          attr_list: [{
                              attr_group_id: "1",
                              attr_group_name: "规格",
                              attr_id: 0,
                              attr_name: ""
                          }],
                          stock: "",
                          price: "",
                          no: "",
                          weight: "",
                          pic_url: "",
                          share_commission_first: 0,
                          share_commission_second: 0,
                          share_commission_third: 0,
                          member_price: {}
                      };
                      this.attr.push(e)
                  },
                  pop: function(e) {
                      this.attr.splice(e, 1)
                  },
                  chooseService: function() {
                      var t = this;
                      t.first_service ? t.$request({
                          url: t.$api.mch.service,
                          data: {
                              mch_id: t.mch_id
                          }
                      }).then(function(i) {
                          if (t.$hideLoading(), 0 == i.code) {
                              t.service = i.data.list,
                              0 == i.data.list.length ? t.modal = !0 : t.is_service = !0;
                              var o = [];
                              i.data.list.forEach(function(e) {
                                  e.isChoose = !1,
                                  1 == e.is_default && (o.push(e), e.isChoose = !0)
                              }),
                              t.set_service = !0,
                              t.beService = o,
                              t.first_service = !1
                          } else e.showToast({
                              title: i.msg,
                              icon: "none",
                              duration: 1e3
                          })
                      }).
                      catch(function() {
                          t.$hideLoading()
                      }) : 0 == t.service.length ? t.modal = !0 : t.is_service = !0
                  },
                  chooseExpress: function() {
                      var t = this;
                      t.$request({
                          url: t.$api.mch.postage,
                          data: {
                              mch_id: t.mch_id
                          }
                      }).then(function(i) {
                          if (t.$hideLoading(), 0 == i.code) if (0 == i.data.list.length) t.set_postage = !0,
                          t.modal = !0,
                          t.postage = i.data.list;
                          else {
                              var o = [];
                              i.data.list.forEach(function(e, t) {
                                  o.push(i.data.list[t].id)
                              });
                              var n = o.indexOf(t.bePostage.id);
                              n > -1 ? (t.postageIndex = n, t.newIndex = n) : t.bePostage = "",
                              t.set_postage = !0,
                              t.dialog = !0,
                              t.postage = i.data.list
                          } else e.showToast({
                              title: i.msg,
                              icon: "none",
                              duration: 1e3
                          })
                      }).
                      catch(function() {
                          t.$hideLoading()
                      })
                  },
                  getCat: function() {
                      var t = this;
                      t.$request({
                          url: t.$api.mch.cat,
                          data: {
                              mch_id: t.mch_id
                          }
                      }).then(function(i) {
                          t.$hideLoading(),
                          0 == i.code ? t.cat = i.data.list: e.showToast({
                              title: i.msg,
                              icon: "none",
                              duration: 1e3
                          })
                      }).
                      catch(function() {
                          t.$hideLoading()
                      })
                  },
                  getMchCat: function() {
                      var t = this;
                      t.$request({
                          url: t.$api.mch.mch_cat,
                          data: {
                              mch_id: t.mch_id
                          }
                      }).then(function(i) {
                          t.$hideLoading(),
                          0 == i.code ? t.mch_cat = i.data.list: e.showToast({
                              title: i.msg,
                              icon: "none",
                              duration: 1e3
                          })
                      }).
                      catch(function() {
                          t.$hideLoading()
                      })
                  },
                  getService: function() {
                      var t = this;
                      t.$request({
                          url: t.$api.mch.service,
                          data: {
                              mch_id: t.mch_id
                          }
                      }).then(function(i) {
                          t.$hideLoading(),
                          0 == i.code ? (t.service = i.data.list, t.beService = [], i.data.list.forEach(function(e) {
                              e.isChoose = !1,
                              1 == e.is_default && (t.beService.push(e), e.isChoose = !0)
                          })) : e.showToast({
                              title: i.msg,
                              icon: "none",
                              duration: 1e3
                          })
                      }).
                      catch(function() {
                          t.$hideLoading()
                      })
                  },
                  getPostage: function() {
                      var t = this;
                      t.$request({
                          url: t.$api.mch.postage,
                          data: {
                              mch_id: t.mch_id
                          }
                      }).then(function(i) {
                          t.$hideLoading(),
                          0 == i.code ? (t.postage = i.data.list, t.bePostage = "", i.data.list.forEach(function(e) {
                              1 == e.status && (t.bePostage = e)
                          })) : e.showToast({
                              title: i.msg,
                              icon: "none",
                              duration: 1e3
                          })
                      }).
                      catch(function() {
                          t.$hideLoading()
                      })
                  }
              },
              onLoad: function(t) {
                  var i = this;
                  e.getSystemInfo({
                      success: function(e) { (e.model.indexOf("iPhone X") > -1 || e.model.indexOf("iPhone 11") > -1 || e.model.indexOf("iPhone11") > -1 || e.model.indexOf("iPhone12") > -1 || e.model.indexOf("Unknown Device") > -1) && (i.iphone_x = !0)
                      }
                  }),
                  i.mch_id = t.mch_id,
                  e.getSystemInfo({
                      success: function(e) {
                          var t = e.windowHeight,
                          o = 750 / e.windowWidth;
                          i.height = t * o
                      }
                  }),
                  i.getCat(),
                  i.getService(),
                  i.getPostage(),
                  i.getMchCat(),
                  e.removeStorage({
                      key: "goods_mch_detail",
                      success: function() {
                          i.goods_detail = []
                      }
                  })
              },
              onShow: function() {
                  var t = this;
                  e.getStorage({
                      key: "goods_mch_detail",
                      success: function(e) {
                          t.goods_detail = e.data
                      }
                  })
              }
          };
          t.
      default = a
      }).call(this, i("543d").
  default)
  },
  "6e58": function(e, t, i) {},
  "964f": function(e, t, i) {
      var o = i("6e58");
      i.n(o).a
  },
  a250: function(e, t, i) {
      i.r(t);
      var o = i("a815"),
      n = i("4b13");
      for (var a in n)"default" !== a &&
      function(e) {
          i.d(t, e,
          function() {
              return n[e]
          })
      } (a);
      i("964f");
      var r = i("2877"),
      c = Object(r.a)(n.
  default, o.a, o.b, !1, null, "a1e266fc", null);
      t.
  default = c.exports
  },
  a815: function(e, t, i) {
      var o = function() {
          var e = this;
          e.$createElement;
          e._self._c,
          e._isMounted || (e.e0 = function(t) {
              e.confine = !e.confine
          })
      },
      n = [];
      i.d(t, "a",
      function() {
          return o
      }),
      i.d(t, "b",
      function() {
          return n
      })
  }
},
[["0202", "common/runtime", "common/vendor"]]]);